<?php

namespace App\Repository\Repositories;

use App\Repository\Repositories\Interfaces\PaymentOrderRepository;
use App\Repository\Models\PaymentOrder;

/**
 * Class PaymentOrderRepositoryEloquent.
 *
 * @package namespace App\Repository\Repositories;
 */
class PaymentOrderRepositoryEloquent extends BaseRepository implements PaymentOrderRepository
{
    /**
     * 搜索
     * @var array
     */
    protected $fieldSearchable = [
    ];

    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return PaymentOrder::class;
    }

    public function paySuccess($trade_no, $pay_at)
    {
        $data = [
            'pay_status' => PaymentOrder::PAY_STATUS_PREPAID,
            'paytime' => $pay_at
        ];
        $this->query()->where(['trade_no' => $trade_no])->update($data);
    }

}
